import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class URLInfoServlet extends HttpServlet {
	protected void doGet(HttpServletRequest req, HttpServletResponse res) 
			throws ServletException, IOException {
		res.setContentType("text/html;charset=utf-8");
		PrintWriter out = res.getWriter();
		
		out.println("<HTML><HEAD><TITLE>Response 정보 출력 Servlet</TITLE>");
		out.println("</HEAD><BODY><H3>요청 방식과 프로토콜 정보</H3>");
		out.println("<pre>Request URI : " + req.getRequestURI());
		out.println("Request URL : " + req.getRequestURL());
		out.println("Context Path : " + req.getContextPath());
		out.println("Request Protocol : " + req.getProtocol());
		out.println("Servlet Path : " + req.getServletPath());
		out.println("</pre>");
		out.println("</BODY></HTML>");
		out.close();
	}
}
